Hi there, |
Re: Layout Attribute which Compares Multi-Valued Enumerations Not going to test this, but perhaps this will work:
// Notice that variable "obj" is pre-defined Object,
// and for Layout and Attr-DXL it has the handle of "this object".
string val1 = probeAttr_(obj, "Variant")
string val2 = probeAttr_(obj, "Category")
if (val1 == val2) //
then display ("True")
else display ("")
// Notice that variable "obj" is pre-defined Object, // and for Layout and Attr-DXL it has the handle of "this object". string val1 = probeAttr_(obj, "Variant") string val2 = probeAttr_(obj, "Category") if (val1 == val2) // then obj.attrDXLName = "True" else obj.attrDXLName = " "
|
Re: Layout Attribute which Compares Multi-Valued Enumerations llandale - Thu Apr 28 12:43:25 EDT 2011 Not going to test this, but perhaps this will work:
// Notice that variable "obj" is pre-defined Object,
// and for Layout and Attr-DXL it has the handle of "this object".
string val1 = probeAttr_(obj, "Variant")
string val2 = probeAttr_(obj, "Category")
if (val1 == val2) //
then display ("True")
else display ("")
// Notice that variable "obj" is pre-defined Object, // and for Layout and Attr-DXL it has the handle of "this object". string val1 = probeAttr_(obj, "Variant") string val2 = probeAttr_(obj, "Category") if (val1 == val2) // then obj.attrDXLName = "True" else obj.attrDXLName = " "
Yes, your attribute DXL did work as I described, however I realize that I described it incorrectly. What I have is the two attributes (I changed the names from "Variant" to "Applicable Categories" and "Category" to "Category Tested" to make things a little clearer). Both can be multiple values from the same enumerated type. Some example data is as such: Example Object 1 Applicable Categories = CAT I, CAT II, CAT III Category Tested = CAT II, CAT III Example Object 2 Applicable Categories = CAT I, CAT II Category Tested = CAT III (Commas indicate the separate values in the enum list) And what I want is to identify with "True" any time the "Category Tested" attribute has any one of the "Applicable Categories" attribute's values. So, in my 2 examples above, Object 1 would return "True" and Object 2 would return "False" ("False" is ok rather than nothing). If anyone knows how to do this I would definitely appreciate the help! Mike |
Re: Layout Attribute which Compares Multi-Valued Enumerations Mike_the_SE - Thu Apr 28 13:46:30 EDT 2011 That is a little trickier. Again I'm not going to bother to test this, but here's some code that should get you going. I'm going to restate your requirement in an equivalent manner such that it makes the DXL easier: you want True if there is any enumerated selected in both attributes.
AttrDef ad = find(Name1)
AttrType at = ad.type
int Size = at.size, i
bool Match =false
string NameEnum
for (i=0; i<Size; i++)
{ NameEnum = at.strings[i]
if (isMember(obj.Name1, NameEnum) and
isMember(obj.Name2, NameEnum)) then Match = true
}
|
Re: Layout Attribute which Compares Multi-Valued Enumerations llandale - Thu Apr 28 14:48:12 EDT 2011 That is a little trickier. Again I'm not going to bother to test this, but here's some code that should get you going. I'm going to restate your requirement in an equivalent manner such that it makes the DXL easier: you want True if there is any enumerated selected in both attributes.
AttrDef ad = find(Name1)
AttrType at = ad.type
int Size = at.size, i
bool Match =false
string NameEnum
for (i=0; i<Size; i++)
{ NameEnum = at.strings[i]
if (isMember(obj.Name1, NameEnum) and
isMember(obj.Name2, NameEnum)) then Match = true
}
Hi,
Module m = current
AttrDef ad = find (m, "Applicable Categories")
AttrType at = ad.type
int Size = at.size, i
bool Match = false
string NameEnum
for (i=0; i<Size; i++) {
NameEnum = at.strings[i]
if (isMember(obj."Applicable Categories", NameEnum) and
isMember(obj."Category Tested", NameEnum)) {
Match = true
}
}
|
Re: Layout Attribute which Compares Multi-Valued Enumerations Mike_the_SE - Fri Apr 29 08:21:52 EDT 2011
Hi,
Module m = current
AttrDef ad = find (m, "Applicable Categories")
AttrType at = ad.type
int Size = at.size, i
bool Match = false
string NameEnum
for (i=0; i<Size; i++) {
NameEnum = at.strings[i]
if (isMember(obj."Applicable Categories", NameEnum) and
isMember(obj."Category Tested", NameEnum)) {
Match = true
}
}
if (Match) // then obj.attrDXLName = "True" else obj.attrDXLName = " "
|
Re: Layout Attribute which Compares Multi-Valued Enumerations llandale - Fri Apr 29 11:55:54 EDT 2011
Thank you very much! That was the piece I was missing. It works beautifully now. I really appreciate the help! Mike |
Re: Layout Attribute which Compares Multi-Valued Enumerations Mike_the_SE - Fri Apr 29 13:48:23 EDT 2011
I am having a similar issue as this thread. I have tried the things that were mentioned above. I have an enumerated type attribute that has following values "A1 , A2, A3, A4". what I am trying to do is have a lay out column that populates based off of what is in this column. Below is a sample of what I have tried to do.
AttrType at = find(current Module, "Test Attr")
int Size = at.size, i
bool Match = false
int NameEnum
string T1 = "A0"
for (i = 0; i < Size; i++) {
NameEnum = at.values[i]
if (0 == NameEnum) { // Or the String using at.strings[i] i have tryed both?
Match = true
}
if (Match) {
display "X"
}
}
|
Re: Layout Attribute which Compares Multi-Valued Enumerations SystemAdmin - Tue Mar 12 11:30:41 EDT 2013
I am having a similar issue as this thread. I have tried the things that were mentioned above. I have an enumerated type attribute that has following values "A1 , A2, A3, A4". what I am trying to do is have a lay out column that populates based off of what is in this column. Below is a sample of what I have tried to do.
AttrType at = find(current Module, "Test Attr")
int Size = at.size, i
bool Match = false
int NameEnum
string T1 = "A0"
for (i = 0; i < Size; i++) {
NameEnum = at.values[i]
if (0 == NameEnum) { // Or the String using at.strings[i] i have tryed both?
Match = true
}
if (Match) {
display "X"
}
}
I don't see how this "layout" will not always display X or not display X.
string ValueDesired = "A0"
// Use the "Definition" name of the attribute, not the "Type" name:
if (isMember(obj."Test Attr", ValueDesired)) //
then display "No"
else display "X"
|